from rest_framework import request
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
from django.contrib.auth.models import Group,Permission
from rest_framework.permissions import IsAdminUser
from meiduo_admin.serializers.admin import AdminSerislizer
from meiduo_admin.serializers.groups import Groupserializer
from meiduo_admin.utils import PageNum
from meiduo_admin.serializers.permissions import PerssionsSerializer
from users.models import User
class AdminView(ModelViewSet):
    serializer_class = AdminSerislizer
    queryset = User.objects.filter(is_staff=True)
    pagination_class = PageNum
    permission_classes = [IsAdminUser]
    def simple(self,request):
        data = Group.objects.all()
        ser = Groupserializer(data,many=True)
        return Response(ser.data)